#ifndef SETTINGS_H_
#define SETTINGS_H_

#include <string>
#include <cublas.h>

using std::string;

#define M_mul(a, b) __mul24(a, b)
#define M_range_check(t, r) ((unsigned)t < (unsigned)r)

class Settings
{
public:
	Settings();
	virtual ~Settings();

	int getImageWidth() const { return imageWidth; }
	void setImageWidth(int i) { imageWidth = i; }
	int getImageHeight() const { return imageHeight; }
	void setImageHeight(int i) { imageHeight = i; }

	float getDivisor() const { return divisor; }
	void setDivisor(float f) { divisor = f; }

	int getDataSizeX() const { return dataSizeX; }
	int getDataSizeY() const { return dataSizeY; }
	int getDataSizeZ() const { return dataSizeZ; }
	void setDataSize(int x, int y, int z) { dataSizeX = x; dataSizeY = y; dataSizeZ = z; }

	inline string getInputFilename() const { return inputFilename; }
	void setInputFilename(const string& s) { inputFilename = s; }

	string getTFFilename(void) const { return TFFilename; }
	void setTFFilename(const string& s) { TFFilename = s; }

	const int* getTFWeights(void) const { return TFWeights; }
	void setTFWeights(int w[10]) { for(int i = 0;i < 10;i++) TFWeights[i] = w[i]; }

	float3 getDirection() const { return direction; }
	void setDirection(float x, float y, float z) { direction.x = x; direction.y = y; direction.z = z; norm(direction); }

	float getScaleFactor() const { return scaleFactor; }
	void setScaleFactor(float f) { scaleFactor = f; }

	inline string getOutputFilename() const { return OUTPUT_FILENAME; }
	inline float getOutputMultiplier() const { return OUTPUT_MULTIPLIER; }
protected:
	void norm(float3& d)
	{
		float l = sqrt(d.x * d.x + d.y * d.y + d.z * d.z);

		d.x /= l;
		d.y /= l;
		d.z /= l;
	}
private:
	int imageWidth;
	int imageHeight;

	int dataSizeX;
	int dataSizeY;
	int dataSizeZ;

	float scaleFactor;
	float divisor;

	string inputFilename;
	string TFFilename;

	float3 direction;

	int TFWeights[10];

	const static string OUTPUT_FILENAME;
	const static float OUTPUT_MULTIPLIER;
};

#endif /* SETTINGS_H_ */
